export default function useSortData() {
  const openSignDialogRef = ref()
  const batchExportDialogRef = ref()
  const batchResetDialogRef = ref()
  const batchAllowCancelDialogRef = ref()
  const resetDialogRef = ref()
  const allowCancelDialogRef = ref()
  const locationFlagDialog = ref()
  // 多选
  const multipleSelection = ref([])
  // 是否展示当前合同预览模板地址
  const isShowContractViewTemplateUrl = ref(false)
  // 批量导出
  const exportFn = () => {
    console.log('导出')
    batchExportDialogRef.value.show()
  }
  // 批量重置
  const batchResetFn = () => {
    console.log('批量重置')
    batchResetDialogRef.value.show()
  }
  // 批量允许作废
  const batchAllowCancelFn = () => {
    console.log('允许作废')
    batchAllowCancelDialogRef.value.show()
  }
  // 全选
  const selectQuestion = val => {
    multipleSelection.value = val
  }
  // 重置
  const resetFn = () => {
    console.log('重置')
    resetDialogRef.value.show()
  }
  // 开放签订
  const openSignFn = () => {
    console.log('开放签订')
    openSignDialogRef.value.show()
  }
  // 关闭签订
  const closeSignFn = () => {
    console.log('关闭签订')
    openSignDialogRef.value.show()
  }
  // 允许作废
  const allowCancelFn = () => {
    console.log('允许作废')
    allowCancelDialogRef.value.show()
  }
  // 取消作废
  const canCancelFn = () => {
    console.log('取消作废')
  }
  // 线下作废
  const offlineCancelFn = () => {
    console.log('线下作废')
  }
  // 预览合同模板
  const viewContract = () => {
    console.log('预览合同模板')
    window.open('https://baidu.com')
  }
  // 显示当前合同预览模板地址
  const showContractViewTemplateUrl = () => {
    if (isShowContractViewTemplateUrl.value) return
    console.log('显示当前合同预览模板地址')
    isShowContractViewTemplateUrl.value = true
  }
  // 开启白名单
  const switchFn = val => {
    console.log('开启白名单', val)
    if (val.locationFlag === 'true') {
      locationFlagDialog.value.show(val.emsStudentId)
    }
  }
  return {
    openSignDialogRef,
    batchExportDialogRef,
    batchResetDialogRef,
    batchAllowCancelDialogRef,
    resetDialogRef,
    allowCancelDialogRef,
    locationFlagDialog,
    multipleSelection,
    isShowContractViewTemplateUrl,
    exportFn,
    batchResetFn,
    batchAllowCancelFn,
    selectQuestion,
    resetFn,
    openSignFn,
    closeSignFn,
    allowCancelFn,
    canCancelFn,
    offlineCancelFn,
    viewContract,
    showContractViewTemplateUrl,
    switchFn
  }
}